{include file="public/header"}

<body>
	<div class="x-nav">
		<span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">客户管理</a>
        <a>
          <cite>客户删除</cite></a>
      </span>
		<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
			<i class="layui-icon" style="line-height:30px">ဂ</i></a>
	</div>
	<div class="x-body">
		<!--<div class="layui-row">
        <form class="layui-form layui-col-md12 x-so">
          <input class="layui-input" placeholder="开始日" name="start" id="start">
          <input class="layui-input" placeholder="截止日" name="end" id="end">
          <input type="text" name="username"  placeholder="请输入用户名" autocomplete="off" class="layui-input">
          <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
        </form>
      </div>-->
		<xblock>
			<button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量恢复</button>
			<span class="x-right" style="line-height:40px">共有数据：{$total} 条</span>
		</xblock>
		<table class="layui-table">
			<thead>
				<tr>
					<th>
						<div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
					</th>
					<th class="text-center">ID</th>
					<th class="text-center">分类名称</th>
					<th class="text-center">排序</th>
					<th class="text-center">操作</th>
				</tr>
			</thead>
			<tbody>
				{volist name="list" id="vo"}
				<tr>
					<td>
						<div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='2'><i class="layui-icon">&#xe605;</i></div>
					</td>
					<td class="text-center">{$vo.id}</td>
					<td class="text-center">{$vo.name}</td>
					<td class="text-center">{$vo.sort}</td>
					<td class="td-manage text-center">
						<a title="恢复" onclick="update({$vo.id})" href="javascript:;" style="margin-left:25px;">
							恢复
						</a>
					</td>
				</tr>
				{/volist}
			</tbody>
		</table>
		

	</div>
	{include file="public/base_js"}
	<script>
		window.addEventListener('storage', function (e) {
			if (e.key =='is_del_news_class') {
				window.location.reload(true);
			}
		}, false);
		function update(id) {
			layer.confirm('确认要恢复吗？', function(index) {
				$.ajax({
					type:"post",
					url:"{:url('admin/newsClass/update_is_del_class')}",
					data: {
						id: Number(id)
					},
					success: function (data) {
						if (data.success) {
							//发异步删除数据
							layer.msg(data.msg, {
								icon: 1,
								time: 1000
							}, function () {
                 	window.localStorage.setItem('update_news_class',new Date().getTime()); 
								 	window.location.reload(true);
							});
						}
					},
					errorr: function () {
						layer.msg('更新失败!', {
							icon: 2,
							time: 1000
						});
					}
				});
				
			});
		}
		function delAll(argument) {

			var data = tableCheck.getData();

			layer.confirm('确认要恢复吗？' + data, function(index) {
				//捉到所有被选中的，发异步进行删除
				layer.msg('恢复成功', {
					icon: 1
				});
				$(".layui-form-checked").not('.header').parents('tr').remove();
			});
		}
	</script>
	<script>
		var _hmt = _hmt || [];
		(function() {
			var hm = document.createElement("script");
			hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
			var s = document.getElementsByTagName("script")[0];
			s.parentNode.insertBefore(hm, s);
		})();
	</script>
</body>

</html>